

# Craig claims this function.
def getLastTextMove(chessboard, format=1):
    """
    Returns the latest move as Algebraic chess notation.
    Returns None if no moves has been made.
    """
    # No move has been done at thos pointer
    if chessboard._state_stack_pointer <= 1:
        return None

    chessboard.undo()
    move = chessboard._moves[chessboard._state_stack_pointer - 1]
    res = chessboard._formatTextMove(move, format)
    chessboard.redo()
    return res
